<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>v-for循环</title>
    <script src="../lib/vue.js"></script>
</head>
<body>
    <div id="app">
       <!-- 1.迭代普通数组-->
        <p v-for="(val,i) in obj1">索引是：{{i}}  ----  值为：{{val}}</p>

        <!--2.迭代对象数组-->
        <p v-for="(user,i) in users">索引是：{{i}} ---- 年纪为：{{user.age}} ----姓名为：{{user.name}}</p>

        <!--3.迭代对象-->
        <p v-for="(val,key,i) in user">索引为：{{i}}------键为：{{key}}-----值为：{{val}}</p>

        <!--4.迭代数字-->
        <p v-for="count in 5">{{count}}</p>
    </div>

    <script>
        var vue = new Vue({
            el:'#app',
            data:{
                obj1:[1,2,3,4,5],
                users:[
                    {age:18,name:'zs'},
                    {age:18,name:'zs1'},
                    {age:18,name:'zs2'},
                    {age:18,name:'zs3'}
                ],
                user:{
                    id:1212,
                    sex:'男'
                }
            }
        });
    </script>
</body>
</html>